<?php
/**
 * Created by Commend.
 * User: Vito
 */

namespace app\validate;

class AdvertsValidate extends BaseValidate
{
    /**
     * 验证规则
     * 可设置语言包字段 语言包分组为valid_field
     * 例如 name|valid_field.name 或 name|name_alias 或 name
     * @var array
     */
    protected $rule = [
        'title'    => 'require|max:50',
        'image'    => 'require|isUrl|max:255',
        'link'     => 'require|max:255',
        'status'   => 'require|checkEnum',
        'agent_id' => 'checkHas:agent',
    ];

    /**
     * 字段对应的名称
     * 可设置语言包字段 语言包分组为valid_field
     * 例如 name => valid_field.name 或 name => name_alias
     * @var array
     */
    protected $field = [

    ];

    /**
     * 验证消息
     * 可设置语言包字段 无分组
     * @var array
     */
    protected $message = [

    ];

    /**
     * 验证场景
     * @var array
     */
    protected $scene = [
        self::SAVE_SCENE   => ['title', 'image', 'link', 'status'],
        self::UPDATE_SCENE => ['title', 'image', 'link', 'status'],
        self::LIST_SCENE   => ['agent_id', 'status'],
    ];
}